﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Windows.Forms;

namespace THSERP.BaseProvider
{
    public class ERPModuleEntitiesFactory
    {
        public static ERPModuleEntities GetModuleEntities(String strModuleName)
        {
            try
            {
                Type moduleEntitiesType = THSApp.THSERPAssembly.GetType("THSERP.Modules." + strModuleName + "." + strModuleName + "Entities");
                return (ERPModuleEntities)moduleEntitiesType.InvokeMember("", BindingFlags.CreateInstance, null, null, null);
            }
            catch (Exception)
            {
                MessageBox.Show("Liên hệ THS để khởi động phân hệ này.", "#Cảnh báo#", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return null;
            }
        }
    }
}
